package com.lsm.sm.service.impl;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lsm.sm.dao.BaseDao;
import com.lsm.sm.entity.Model;
import com.lsm.sm.entity.User;
import com.lsm.sm.entity.UserEducation;
import com.lsm.sm.service.ProfileService;
import com.lsm.sm.util.Const;
import com.lsm.sm.util.WebUtil;

@Scope("prototype")
@Service("profileService")
public class ProfileServiceImpl implements ProfileService {
	private static final long serialVersionUID = -5683772716011506932L;
	
	@Resource
	private BaseDao baseDao;
	
	@Transactional
	public void baseProfile( Model... models ){
		User user = (User)models[0]; 
		Integer id = user.getId();
		
		UserEducation userEdu = (UserEducation)models[1];
		userEdu.setUser( id );
		baseDao.save( user );
		baseDao.save( userEdu );
		WebUtil.addInSession( Const.USER, user );
	}

	@Override
	public void detailProfile(Model... models) {
		
	}
}
